"""
@version:python3
@author:ll
@file:04-QWidget-事件消息.py
@time:2022/2/9 22:46
"""
from PyQt5.Qt import *


class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("事件消息的学习")
        self.resize(500, 500)
        self.setup_ui()

    def setup_ui(self):  # 添加子控件以及子控件的配置操作
        pass
    def showEvent(self, QShowEvent):
        print("窗口被展示了出来")
    def closeEvent(self, QCloseEvent):
        print("窗口被关闭了")
    def moveEvent(self, QMoveEvent):
        print("窗口被移动了")
    def enterEvent(self,QEvent):
        print("鼠标进来了")
        self.setStyleSheet("background-color:yellow;")
    def leaveEvent(self, QEvent):
        print("鼠标出去了")
        self.setStyleSheet("background-color:green;")





if __name__ == "__main__":
    import sys

    app = QApplication(sys.argv)
    window = Window()
    window.show()

    sys.exit(app.exec_())
